package cn.it.hbtt.daoimg;
/**
 * 从use数据库中调出数据
 */
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import cn.it.hbtt.dao.BaseDAO;
import cn.it.hbtt.entity.User;

public class Usering {
	public List use() {
		List<User> list = new ArrayList<User>();
		
		try {
			BaseDAO base = new BaseDAO();
			Connection conn = base.getConnection();
			System.out.println(conn);

			Statement stm = conn.createStatement();
			ResultSet rs = stm.executeQuery("select * from easybuy_user");
		

			while (rs.next() == true) {
				User g = new User();
				g.setId(rs.getInt("id"));
				g.setLoginName(rs.getString("loginName"));
				g.setUserName(rs.getString("userName"));
				g.setPassword(rs.getString("password"));
				g.setSex(rs.getInt("sex"));
				g.setIdentityCode(rs.getString("identityCode"));
				g.setEmail(rs.getString("email"));
				g.setMobile(rs.getString("mobile"));
				g.setType(rs.getInt("type"));
				list.add(g);

			}
		} catch (Exception e) {
			// TODO: handle exception
		}
		return list;
	}

}
